home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / ronset25.zip / EXAMPLES.RON < prev    next >
Text File  |  1990-08-18  |  8KB  |  222 lines

  1.  
  2. ;       This file shows many of the abilities of RONSET in batch mode.
  3. ;       It is not meant to be complete, or even very useful...
  4. ;       Type RONSET batch(examples.ron) to execute it.
  5.  
  6. ; Make an "up" sound
  7. sound(200,440,880,1760,3520)
  8.  
  9. ; Clear the screen
  10. echo(chr(27)[H chr(27)[2J)
  11.  
  12. echo()  echo(           RONSET SAMPLE PROGRAM)
  13.         echo(           ------ ------ -------)
  14.  
  15. echo()
  16. echo(In response to the next two questions, you may type "124" for the  )
  17. echo("Net:" question, and "1113" for the "Node:" question.  This is the )
  18. echo(example from the documentation.  The result should be 007c0459.REQ )
  19. echo()
  20. fname=low(concat(hex(string(Net:,5)),hex(string(Node:,5))).REQ)
  21. echo(The result is "trans(fname)".)
  22. fname=
  23.  
  24. echo()  char(Press any key to continue,,30)  echo(chr(27)[H chr(27)[2J)  echo()
  25.  
  26. echo(Arithmetic)  echo(----------)
  27. x1=string( Enter first number:,5)
  28. x2=string(Enter second number:,5)
  29. =echo(trans(x1) + trans(x2) = add(trans(x1),trans(x2)))
  30. =echo(trans(x1) - trans(x2) = sub(trans(x1),trans(x2)))
  31. =echo(trans(x1) * trans(x2) = mult(trans(x1),trans(x2)))
  32. =echo(trans(x1) / trans(x2) = div(trans(x1),trans(x2)))
  33. =echo(trans(x1) % trans(x2) = mod(trans(x1),trans(x2)))
  34. =echo(if(eq(trans(x1),trans(x2)),trans(x1) = trans(x2)))
  35. echo(if(ne(trans(x1),trans(x2)),trans(x1) <> trans(x2)))
  36. echo(if(lt(trans(x1),trans(x2)),trans(x1) < trans(x2)))
  37. =echo(if(le(trans(x1),trans(x2)),trans(x1) <= trans(x2)))
  38. echo(if(gt(trans(x1),trans(x2)),trans(x1) > trans(x2)))
  39. =echo(if(ge(trans(x1),trans(x2)),trans(x1) >= trans(x2)))
  40. echo(Absolute values are abs(trans(x1)) and abs(trans(x2)))
  41. echo(Negative values are neg(trans(x1)) and neg(trans(x2)))
  42. echo(Squared values are sqr(trans(x1)) and sqr(trans(x2)))
  43. echo(Square roots are sqrt(abs(trans(x1))) and sqrt(abs(trans(x2))))
  44. echo('trans(x1)' is if(num(trans(x1)),,not )completely digits)
  45. echo('trans(x2)' is if(num(trans(x2)),,not )completely digits)
  46. echo('trans(x1)' is if(number(trans(x1)),,not )completely numeric)
  47. echo('trans(x2)' is if(number(trans(x2)),,not )completely numeric)
  48.  
  49. echo()  char(Press any key to continue,,30)  echo(chr(27)[H chr(27)[2J)  echo()
  50.  
  51. echo(Binary Arithmetic)  echo(------ ----------)  echo()
  52. echo(function       binary        octal    hex    decimal)
  53. echo(--------  ----------------   ------   ----   -------)
  54. echo(  1st     bin(trans(x1))   oct(trans(x1))   hex(trans(x1))     trans(x1))
  55. echo(  2nd     bin(trans(x2))   oct(trans(x2))   hex(trans(x2))     trans(x2))
  56. echo(--------  ----------------   ------   ----   -------)
  57. x3=and(trans(x1),trans(x2))
  58. echo(  AND     bin(trans(x3))   oct(trans(x3))   hex(trans(x3))     trans(x3))
  59. x3=or(trans(x1),trans(x2))
  60. echo(  OR      bin(trans(x3))   oct(trans(x3))   hex(trans(x3))     trans(x3))
  61. x3=xor(trans(x1),trans(x2))
  62. echo(  XOR     bin(trans(x3))   oct(trans(x3))   hex(trans(x3))     trans(x3))
  63. x3=not(trans(x1))
  64. echo(NOT 1st   bin(trans(x3))   oct(trans(x3))   hex(trans(x3))     trans(x3))
  65. x3=not(trans(x2))
  66. echo(NOT 2nd   bin(trans(x3))   oct(trans(x3))   hex(trans(x3))     trans(x3))
  67. x1=
  68. x2=
  69. x3=
  70.  
  71. echo()  char(Press any key to continue,,30)  echo(chr(27)[H chr(27)[2J)  echo()
  72.  
  73. echo(String Functions)  echo(------ ---------)  echo()
  74. ---------------------
  75. fn=string(What is your FIRST name?,15)
  76. x=len(trans(fn))
  77. ;if nothing entered, change it to my name
  78. fn=if(eq(trans(x),0),rON,trans(fn))
  79. x=sub(len(trans(fn)),1)
  80. ;fix up capitalization
  81. fn=concat(up(left(1,trans(fn))),low(right(trans(x),trans(fn))))
  82. ;---------------------
  83. mn=string(What is your MIDDLE name?,10)
  84. x=len(trans(mn))
  85. ;if nothing entered, change it to my name
  86. mn=if(eq(trans(x),0),aLAN,trans(mn))
  87. x=sub(len(trans(mn)),1)
  88. ;fix up capitalization
  89. mn=concat(up(left(1,trans(mn))),low(right(trans(x),trans(mn))))
  90. ;---------------------
  91. ln=string(What is your LAST name?,15)
  92. x=len(trans(ln))
  93. ;if nothing entered, change it to my name
  94. ln=if(eq(trans(x),0),bEMIS,trans(ln))
  95. x=sub(len(trans(ln)),1)
  96. ;fix up capitalization
  97. ln=concat(up(left(1,trans(ln))),low(right(trans(x),trans(ln))))
  98. ;---------------------
  99. mi=mid(1,1,trans(mn))
  100. echo()
  101. echo(Middle initial is trans(mi), which is ASCII character asc(trans(mi)))
  102. echo(trans(fn) trans(mn) trans(ln))
  103. echo(trans(fn) trans(mi). trans(ln))
  104. echo(trans(fn) trans(ln))
  105. echo(left(1,trans(fn)). left(1,trans(mn)). left(1,trans(ln)).)
  106. echo(concat(left(1,trans(fn)),left(1,trans(mn)),left(1,trans(ln))))
  107. fl=trans(fn) trans(mn) trans(ln)
  108. echo(up(trans(fl)))
  109. echo(low(trans(fl)))
  110. mn=
  111. mi=
  112. x=
  113.  
  114. echo()  char(Press any key to continue,,30)  echo(chr(27)[H chr(27)[2J)  echo()
  115.  
  116. echo(String Search/Replace)  echo(------ --------------)  echo()
  117. echo(trans(fl))
  118. echo()
  119. x=char(Press a letter that's in your name:,trans(fl))
  120. y=pos(trans(x),trans(fl))
  121. echo(That letter first appears in position trans(y) of your name)
  122. echo(Here's your name with 'trans(x)' changed to '*':)
  123. echo(replace(trans(x),*,trans(fl)))
  124. fl=
  125. x=
  126. y=
  127.  
  128. echo()  char(Press any key to continue,,30)  echo(chr(27)[H chr(27)[2J)  echo()
  129.  
  130. echo(String Comparisons)  echo(------ -----------)  echo()
  131. =echo(if(eqs(trans(fn),trans(ln)),trans(fn) = trans(ln)))
  132. echo(if(nes(trans(fn),trans(ln)),trans(fn) <> trans(ln)))
  133. echo(if(lts(trans(fn),trans(ln)),trans(fn) < trans(ln)))
  134. =echo(if(les(trans(fn),trans(ln)),trans(fn) <= trans(ln)))
  135. echo(if(gts(trans(fn),trans(ln)),trans(fn) > trans(ln)))
  136. =echo(if(ges(trans(fn),trans(ln)),trans(fn) >= trans(ln)))
  137. echo('trans(fn)' is if(alpha(trans(fn)),,not )completely alphabetic)
  138. fn=
  139. ln=
  140.  
  141. echo()  char(Press any key to continue,,30)  echo(chr(27)[H chr(27)[2J)  echo()
  142.  
  143. echo(Files)  echo(-----)  echo()
  144. file=string(Type a filename:,50)
  145. echo(Base filename with extension is file(trans(file)))
  146. echo(Base filename is name(trans(file)))
  147. echo(Extension is ext(trans(file)))
  148. echo(Disk drive is drive(trans(file)))
  149. echo(Directory path is path(trans(file)))
  150. echo(Full filespec is full(trans(file)))
  151. echo(Drive and directory is dir(trans(file)))
  152. echo(There are matches(trans(file)) files that match this filename)
  153. echo(This filename if(wild(trans(file)),contains,does not contain) wildcards)
  154. echo(The first match is expand(trans(file)))
  155. file=expand(trans(file))
  156.  
  157. echo()  char(Press any key to continue,,30)  echo(chr(27)[H chr(27)[2J)  echo()
  158.  
  159. echo(trans(file))  echo()
  160. echo(This file if(exist(trans(file)),exists,does not exist))
  161. echo(Size of 'trans(file)' is size(trans(file)))
  162. echo(Date of 'trans(file)' is fdate(trans(file)))
  163. echo(This file contains lines(trans(file)) lines)
  164. echo(This is the first line of the file:)
  165. echo('read(trans(file),1)')
  166. echo()
  167. x=attr(trans(file))
  168. echo(This file's attributes are bin(trans(x)))
  169. echo(  if(eq(or(1,trans(x)),1),Read-only,Read/Write))
  170. echo(  if(eq(or(2,trans(x)),2),Hidden,Non-Hidden))
  171. echo(  if(eq(or(4,trans(x)),4),System,Non-System))
  172. echo(  if(eq(or(16,trans(x)),16),Directory,Non-Directory))
  173. echo(  if(eq(or(32,trans(x)),32),Archive,Non-Archive))
  174. echo(The default disk's label is 'label()')
  175. x=
  176.  
  177. echo()  char(Press any key to continue,,30)  echo(chr(27)[H chr(27)[2J)  echo()
  178.  
  179. echo(Peeking into Files)  echo(------- ---- -----)  echo()
  180. echo(trans(file))  echo()
  181. echo(byte at offset 20 is byte(20,trans(file)))
  182. echo(word at offset 20 is word(20,trans(file)))
  183. echo(long at offset 20 is long(20,trans(file)))
  184. echo(line at offset 20 is:)
  185. echo(line(20,trans(file)))
  186. file=
  187.  
  188. echo()  char(Press any key to continue,,30)  echo(chr(27)[H chr(27)[2J)  echo()
  189.  
  190. echo(DOS directory:)
  191. exec(trans(COMSPEC) /C DIR /W)
  192.  
  193. echo()  char(Press any key to continue,,30)  echo(chr(27)[H chr(27)[2J)  echo()
  194.  
  195. echo(Miscellaneous)  echo(-------------)  echo()
  196. x=free()
  197. y=total()
  198. z=used()
  199. echo(Disk space on this drive: trans(y))
  200. echo(Free space on this drive: trans(x) [div(mult(100,trans(x)),trans(y))%])
  201. echo(Used space on this drive: trans(z) [div(mult(100,trans(z)),trans(y))%])
  202. echo()
  203. x=env()
  204. y=tenv()
  205. z=sub(trans(y),trans(x))
  206. echo(Environment space: trans(y))
  207. echo(Free environment space: trans(x) [div(mult(100,trans(x)),trans(y))%])
  208. echo(Used environment space: trans(z) [div(mult(100,trans(z)),trans(y))%])
  209. echo()
  210. echo(DOS version ver(both) -